
package com.cbwl.eoas.cms.model.sysconfig;

import javax.validation.constraints.Max;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.base.CommonBean;
import com.cbwl.eoas.common.cache.redis.RedisCache;
import com.cbwl.eoas.common.cache.redis.RedisKeyPrefix;
import com.cbwl.eoas.common.util.SpringContextUtil;

/**
 * 
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月20日 下午5:25:52
 */
public class SysUserDTO extends CommonBean {

	private static final long serialVersionUID = -5790428879920054294L;
	private java.lang.Long id;
	@NotBlank @Length(max=20)
	private java.lang.String userLoginname;
	@Length(max=128)
	private java.lang.String userJobno;
	@NotBlank @Length(max=32)
	private java.lang.String userPassword;
	@Length(max=20)
	private java.lang.String userPhone;
	@Email @Length(max=50)
	private java.lang.String userEmail;
	@Length(max=5)
	private java.lang.String userType;
	@Max(127)
	private Integer loginPwdErrorNum;
	
	private java.util.Date loginPwdLastTime;
	@Max(127)
	private Integer onlineis;
	@Length(max=5)
	private java.lang.String userStatus;
	
	private java.lang.Long empId;
	
	private java.lang.Long creater;
	
	private java.util.Date gmtCreate;
	
	private java.lang.Long modifier;
	
	private java.util.Date gmtModified;
	
	//tokenId 
	private String tokenId;
	
	//columns END
	private String userStatusName;
	
	//用户类型
	private String userTypeName;
	
	//用户头像
	private String empAvatar;
	
	
	
	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	public java.lang.Long getId() {
		return this.id;
	}
	
	public void setUserLoginname(java.lang.String value) {
		this.userLoginname = value;
	}
	
	public java.lang.String getUserLoginname() {
		return this.userLoginname;
	}
	
	public void setUserJobno(java.lang.String value) {
		this.userJobno = value;
	}
	
	public java.lang.String getUserJobno() {
		return this.userJobno;
	}
	
	public void setUserPassword(java.lang.String value) {
		this.userPassword = value;
	}
	
	public java.lang.String getUserPassword() {
		return this.userPassword;
	}
	
	public void setUserPhone(java.lang.String value) {
		this.userPhone = value;
	}
	
	public java.lang.String getUserPhone() {
		return this.userPhone;
	}
	
	public void setUserEmail(java.lang.String value) {
		this.userEmail = value;
	}
	
	public java.lang.String getUserEmail() {
		return this.userEmail;
	}
	
	public void setUserType(java.lang.String value) {
		this.userType = value;
		if (!StringUtils.isEmpty(value)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+value);
			if (!StringUtils.isEmpty(redisValue)) {
				this.userTypeName = redisValue;
			}
		}
	}
	
	public java.lang.String getUserType() {
		return this.userType;
	}
	
	public void setLoginPwdErrorNum(Integer value) {
		this.loginPwdErrorNum = value;
	}
	
	public Integer getLoginPwdErrorNum() {
		return this.loginPwdErrorNum;
	}
	
	public void setLoginPwdLastTime(java.util.Date value) {
		this.loginPwdLastTime = value;
	}
	
	public java.util.Date getLoginPwdLastTime() {
		return this.loginPwdLastTime;
	}
	
	public void setOnlineis(Integer value) {
		this.onlineis = value;
	}
	
	public Integer getOnlineis() {
		return this.onlineis;
	}
	
	public void setUserStatus(java.lang.String value) {
		this.userStatus = value;
		if (!StringUtils.isEmpty(value)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+value);
			if (!StringUtils.isEmpty(redisValue)) {
				this.userStatusName = redisValue;
			}
		}
	}
	
	public java.lang.String getUserStatus() {
		return this.userStatus;
	}
	

	public void setEmpId(java.lang.Long value) {
		this.empId = value;
	}
	
	public java.lang.Long getEmpId() {
		return this.empId;
	}
	
	public void setCreater(java.lang.Long value) {
		this.creater = value;
	}
	
	public java.lang.Long getCreater() {
		return this.creater;
	}
	
	public void setGmtCreate(java.util.Date value) {
		this.gmtCreate = value;
	}
	
	public java.util.Date getGmtCreate() {
		return this.gmtCreate;
	}
	
	public void setModifier(java.lang.Long value) {
		this.modifier = value;
	}
	
	public java.lang.Long getModifier() {
		return this.modifier;
	}
	
	public void setGmtModified(java.util.Date value) {
		this.gmtModified = value;
	}
	
	public java.util.Date getGmtModified() {
		return this.gmtModified;
	}
	
	public String getTokenId() {
		return tokenId;
	}

	
	public void setTokenId(String tokenId) {
		this.tokenId = tokenId;
	}
	
	public String getUserStatusName() {
		return userStatusName;
	}

	
	public void setUserStatusName(String userStatusName) {
		this.userStatusName = userStatusName;
	}
	
	public String getUserTypeName() {
		return userTypeName;
	}

	
	public void setUserTypeName(String userTypeName) {
		this.userTypeName = userTypeName;
	}

	
	
	
	
	public String getEmpAvatar() {
		return empAvatar;
	}

	
	public void setEmpAvatar(String empAvatar) {
		this.empAvatar = empAvatar;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("UserLoginname",getUserLoginname())
			.append("UserJobno",getUserJobno())
			.append("UserPassword",getUserPassword())
			.append("UserPhone",getUserPhone())
			.append("UserEmail",getUserEmail())
			.append("UserType",getUserType())
			.append("LoginPwdErrorNum",getLoginPwdErrorNum())
			.append("LoginPwdLastTime",getLoginPwdLastTime())
			.append("Onlineis",getOnlineis())
			.append("UserStatus",getUserStatus())
			.append("EmpId",getEmpId())
			.append("Creater",getCreater())
			.append("GmtCreate",getGmtCreate())
			.append("Modifier",getModifier())
			.append("GmtModified",getGmtModified())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof SysUserDTO == false){return false;}
		if(this == obj){return true;}
		SysUserDTO other = (SysUserDTO)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

